<?php defined('_JEXEC') or die('Restricted access'); ?>

<?php
JRequest::setVar( 'hidemainmenu', 1 );

if ($this->row->image == '') {
    $this->row->image = 'blank.png';
}

JHTML::_('behavior.tooltip');         
JFilterOutput::objectHTMLSafe( $this->row, ENT_QUOTES, 'misc' );
$editor = &JFactory::getEditor(); 
?>
<script language="javascript" type="text/javascript">
<!--
function submitbutton(pressbutton) {
    var form = document.adminForm;
    if (pressbutton == 'cancel') {
        submitform( pressbutton );
        return;
    }

    // do field validation
    if ( form.name.value == "" ) {
        alert( "<?php echo JText::_( 'You must provide a name.', true ); ?>" );
    } else if ( form.position.value == 0 ) {
        alert( "<?php echo JText::_( 'Please select a Category.', true ); ?>" );
    } else {
        submitform( pressbutton );
    } 
}

function changeImage(){
    if (document.forms.adminForm.image.value != '') {
        document.forms.adminForm.image_src.src='../'+document.forms.adminForm.image.value;
    } 
    else {
        document.forms.adminForm.image_src.src='../images/blank.png';
    }
}
//-->
</script>

<form action="index.php?<?php echo $this->component; ?>" method="post" name="adminForm">     
    <div class="col width-80">
        <fieldset class="adminform">
            <legend><?php echo JText::_( 'Details' ); ?></legend>  
                        
            <table class="adminform">
                <tr>                 
                    <td>
                        <label for="name"><?php echo JText::_( 'Name' ); ?>:</label>
                    </td>
                    <td>
                        <input class="inputbox" type="text" name="name" id="name" size="60" maxlength="255" value="<?php echo $this->row->name; ?>" />
                    </td>              
                    <td>
                        <label for="position"><?php echo JText::_( 'Position' ); ?>:</label>
                    </td>
                    <td>
                        <input class="inputbox" type="text" name="position" id="position" size="60" maxlength="255" value="<?php echo $this->row->position; ?>" />
                    </td>                     
                </tr>
                <!--   
                <tr>           
                    <td>
                        <label for="address"><?php echo JText::_( 'Address' ); ?>:</label>
                    </td>
                    <td colspan="3">
                        <input class="inputbox" type="text" name="address" id="address" size="176" maxlength="500" value="<?php echo $this->row->address; ?>" />
                    </td>
                </tr>
                -->
                <tr>
                    <td>
                        <label for="title"><?php echo JText::_( 'Title' ); ?>:</label>
                    </td>
                    <td>
                        <input class="inputbox" type="text" name="title" id="title" size="60" maxlength="255" value="<?php echo $this->row->title; ?>" />
                    </td>
                    <td>
                        <?php echo JText::_( 'Published' ); ?>:
                    </td>
                    <td>
                        <?php echo $this->lists['published']; ?>
                    </td> 
                </tr>
                <tr>           
                    <td valign="top">
                        <label for="ordering"><?php echo JText::_( 'Ordering' ); ?>:</label> 
                    </td>
                    <td>
                        <input class="inputbox" type="text" name="ordering" id="ordering" size="60" maxlength="255" value="<?php echo $this->row->ordering; ?>" />
                    </td>
                    <td colspan="2">&nbsp;</td>
                </tr>     
                <tr>
                    <td colspan="4"><?php echo $editor->display( 'description',  $this->row->description , '100%', '550', '75', '20' ) ; ?></td>
                </tr> 
            </table>
        </fieldset>  
    </div>     
    <div class="col width-20">
        <fieldset class="adminform">
            <legend><?php echo JText::_( 'Image' ); ?></legend>    
            <?php 
            echo $this->pane->startPane("menu-pane");
            ?>
            <table cellspacing="0" width="100%" height="50" class="paramlist admintable">
                <tbody>
                    <tr>
                        <td style="padding-left: 25px;">
                            <a href="<? echo $this->row->image ? JURI::root(). $this->row->image : 'javascript:void(0);'; ?>" title="Image" class="modal-button">
                                <img width="150" height="150" id="image_src" name="image_src" src="<? echo JURI::root(). $this->row->image; ?>" />
                            </a>
                        </td>   
                    </tr>
                    <tr>                   
                        <td class="paramlist_value" valign="bottom" style="padding-left: 25px;">
                            <input type="hidden" class="text_area" value="<? echo $this->row->image; ?>" id="image" name="image" onchange="changeImage()" />
                            <a rel="{handler: 'iframe', size: {x: 760, y: 520}}" href="index.php?option=com_rokquickcart&amp;view=images&amp;tmpl=component&amp;e_name=image" title="" class="modal-button">Upload</a>
                        </td>
                    </tr>
                </tbody>
            </table>
            <?php
            echo $this->pane->endPane();              
            ?>
        </fieldset>
    </div>
    <div class="clr"></div>
    
    <input type="hidden" name="option" value="com_mwc_employee" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
    <input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
    <input type="hidden" name="id" value="<?php echo $this->row->id; ?>" />   
    <?php echo JHTML::_( 'form.token' ); ?>
</form>
